
* Do File
* "Politician Hate Speech and Domestic Terrorism"
* International Interactions
* James A. Piazza, Department of Political Science, The Pennsylvania State University
* jap45@psu.edu


* Variable Names: 

* domestic = counts of domestic terrorism (main DV)
* hate_speech = hate speech by political parties
* polarization = polarization 
* gov_censor_media = government censorship of social media
* polity2 = regime type, Polity 2 score
* polity_sq = squared measure of Polity 2
* durable = regime durability from Polity
* log_pop = natural log of population
* log_gdp_percap = natural log, gross domestic product per capita
* ucdp_internal = interstate conflict (UCDP)
* lack_defame_prot = weak anti-defamation or hate speech legislation
* al_ethnic = ethnic fractionalization, Alesina et al.




***************************************
*** Table 1, Descriptive Statistics ***
sum domestic hate_speech polarization gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap ucdp_internal domestic lack_defame_prot if included==1

* Note "included==1" limits sample to only yearly observations where there is data for all variables in the estimation (2000-2017).  This produces more representative descriptives statistics.

***************************************





******************************
*** Table 2.  Main Results ***

* Model 1
nbreg lead_domestic hate_speech domestic, nolog cluster(ccode)
mfx compute, at(mean)

* Model 2
nbreg lead_domestic hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap al_ethnic ucdp_internal domestic, nolog cluster(ccode)
mfx compute, at(mean)

* Model 3
nbreg lead_domestic hate_speech polarization gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap al_ethnic ucdp_internal domestic, nolog cluster(ccode)

* Model 4
xtset ccode year
xtnbreg lead_domestic hate_speech polarization gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap al_ethnic ucdp_internal domestic, nolog fe
mfx compute, at(mean)

* Model 5
nbreg lead_domestic hate_speech polarization gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap al_ethnic ucdp_internal, nolog cluster(ccode)
mfx compute, at(mean)
******************************





***********************************
*** Table 3.  Endogeneity Tests ***

* Model 6
ivregress 2sls lead_domestic domestic (hate_speech=lack_defame_prot)
estat endog

* Model 7
ivregress 2sls lead_domestic gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap ucdp_internal domestic (hate_speech=lack_defame_prot)
estat endog
***********************************





***********************************
*** Figure 1.  Marginal Effects ***
* Figure 1
nbreg lead_domestic hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap ucdp_internal domestic, nolog cluster(ccode)
mfx compute, at(mean)
***********************************





***************************************************************************************************
*** Figure 2.  Impact of political party use of hate speech on projected incidents of terrorism ***
mfx compute, at(hate_speech=0 gov_censor_media=2 polity2=3 polity_sq=49 durable=23 log_pop=15.9 log_gdp_percap=8.1 al_ethnic=.437 ucdp_internal=0 domestic=20)
mfx compute, at(hate_speech=1 gov_censor_media=2 polity2=3 polity_sq=49 durable=23 log_pop=15.9 log_gdp_percap=8.1 al_ethnic=.437 ucdp_internal=0 domestic=20)
mfx compute, at(hate_speech=2 gov_censor_media=2 polity2=3 polity_sq=49 durable=23 log_pop=15.9 log_gdp_percap=8.1 al_ethnic=.437 ucdp_internal=0 domestic=20)
mfx compute, at(hate_speech=3 gov_censor_media=2 polity2=3 polity_sq=49 durable=23 log_pop=15.9 log_gdp_percap=8.1 al_ethnic=.437 ucdp_internal=0 domestic=20)
mfx compute, at(hate_speech=4 gov_censor_media=2 polity2=3 polity_sq=49 durable=23 log_pop=15.9 log_gdp_percap=8.1 al_ethnic=.437 ucdp_internal=0 domestic=20)
***************************************************************************************************





************************************
*** Figure 3.  Test of Mediation ***

* Transform Y into a dummy variable
gen lead_domestic_bi=0
replace lead_domestic_bi=1 if lead_domestic>0
replace lead_domestic_bi=. if lead_domestic==.

* Run mediation test.  
medeff (regress polarization hate_speech ) (logit lead_domestic_bi hate_speech polarization), mediate(polarization) treat(hate_speech) vce(boot)

* Run sensitivity analysis
medsens (regress polarization hate_speech) (logit lead_domestic_bi hate_speech polarization), mediate(polarization) treat(hate_speech)

* result is that error terms/residuals of hate speech -> polarization (Ei2) and polarization -> terrorism (Ei3) should not be correlated above .3

* calculate residuals

* Ei2
regress polarization hate_speech
predict resid, resid
rename resid resid_Ei2

* Ei3
logit lead_domestic_bi polarization
predict resid, resid
rename resid resid_Ei3

* then test for correlation between residuals
pwcorr resid_Ei2 resid_Ei3
* rsquare = .0221, which is less than .3

drop lead_domestic_bi _med_rho _med_delta0 _med_updelta0 _med_lodelta0 _med_delta1 _med_updelta1 _med_lodelta1 lead_domestic_bi resid_Ei2 resid_Ei3


* also note that mediation is evident when you use regress too and ignore the fact that the DV is a count variable

* mediation test.  
medeff (regress polarization hate_speech) (regress lead_domestic hate_speech polarization), mediate(polarization) treat(hate_speech) vce(boot)
************************************




*****************************************************************
*** Appendix Table 1.  List of Countries Included in Analysis ***
tab country_name
*****************************************************************


*********************************************************
*** Appendix Table 2.  Dichotomous Dependent Variable ***

gen lead_domestic_bi=0
replace lead_domestic_bi=1 if lead_domestic>0
replace lead_domestic_bi=. if lead_domestic==.

gen domestic_bi=0
replace domestic_bi=1 if domestic>0
replace domestic_bi=. if domestic==.

* Model 1
logit lead_domestic_bi hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap al_ethnic ucdp_internal domestic_bi, nolog cluster(ccode)

drop lead_domestic_bi domestic_bi
*********************************************************



******************************************************************************************
*** Appendix Table 3.  Results with non-lagged and 2-year lagged independent variables ***


* Model 1.
nbreg domestic hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap ucdp_internal domestic, nolog cluster(ccode)

* Model 2
sort ccode year
by ccode: gen domestic_lead2=domestic[_n+2]
nbreg domestic_lead2 hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap ucdp_internal domestic, nolog cluster(ccode)
drop domestic_lead2
******************************************************************************************




*****************************************************************************************
*** Appendix Table 4.  Instrument Check, Weak Anti-Defamation/Hate Speech Legislation ***

* Model 1
ologit lead_hate_speech lack_defame_prot hate_speech, nolog cluster(ccode)

* Model 2
nbreg lead_domestic lack_defame_prot domestic, nolog cluster(ccode)

* Model 3
nbreg lead_domestic lack_defame_prot gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap ucdp_internal domestic, nolog cluster(ccode)

* Model 4
nbreg lead_domestic lack_defame_prot hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap ucdp_internal domestic, nolog cluster(ccode)

* Model 5
xtset ccode year
xtnbreg lead_domestic lack_defame_prot hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap ucdp_internal domestic, nolog fe
*****************************************************************************************



**************************************************************************************************************
*** Appendix Table 5.  Effects of Hate Speech on Domestic Terrorism in High and Low Polarization Countries ***

gen lo_polar=0
replace lo_polar=1 if polarization==0
replace lo_polar=1 if polarization==1
replace lo_polar=. if polarization==.

gen hi_polar=0
replace hi_polar=1 if polarization==2
replace hi_polar=1 if polarization==3
replace hi_polar=1 if polarization==4
replace hi_polar=. if polarization==.

gen vryhi_polar=0
replace vryhi_polar=1 if polarization==4
replace vryhi_polar=1 if polarization==5

* Model 1
nbreg lead_domestic hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap al_ethnic ucdp_internal domestic if lo_polar==1, nolog cluster(ccode)

* Model 2
nbreg lead_domestic hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap al_ethnic ucdp_internal domestic if hi_polar==1, nolog cluster(ccode)

* Model 3
nbreg lead_domestic hate_speech gov_censor_media polity2 polity_sq durable log_pop log_gdp_percap al_ethnic ucdp_internal domestic if vryhi_polar==1, nolog cluster(ccode)


drop lo_polar hi_polar vryhi_polar
**************************************************************************************************************



***********************************************************************
*** Appendix Figure 1.  Hate Speech and Polarization by Regime Type ***

gen democracy =0
replace democracy=1 if polity2>5
replace democracy=. if polity2==.

gen anocracy=0
replace anocracy=1 if polity2>-6 & polity2<6
replace anocracy=. if polity2==.

gen dictatorship=0
replace dictatorship=1 if polity2<-6

sum hate_speech polarization if democracy==1
sum hate_speech polarization if democracy==1
sum hate_speech polarization if anocracy==1
sum hate_speech polarization if anocracy==1
sum hate_speech polarization if dictatorship==1
sum hate_speech polarization if dictatorship==1
sum hate_speech polarization 
sum hate_speech polarization 

drop democracy anocracy dictatorship
***********************************************************************



************************************************************************
*** Appendix Figure 2.  Hate Speech and Polarization by World Region ***

sum hate_speech polarization if sa_region==1
sum hate_speech polarization  if sea_region==1
sum hate_speech polarization  if ea_region==1
sum hate_speech polarization  if wena_region==1
sum hate_speech polarization  if ssa_region==1
sum hate_speech polarization  if mena_region==1
sum hate_speech polarization  if la_region==1
sum hate_speech polarization  if eeca_region==1
************************************************************************


******************************************************************
*** Appendix Figure 3.  Hate Speech and Polarization Over Time ***

sort year
by year: sum hate_speech polarization
******************************************************************

       






















